<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>index</title>
</head>
<body>
<h2>这是首页哦</h2>
<button onclick="clickHandle()">点我</button>

<table border="1px">
    <tr>
        <td>主键</td>
        <td>书名</td>
        <td>作者</td>
        <td>价格</td>
        <td>创建时间</td>
    </tr>
    {% for item in books %}
    <tr>
        <td>{{item.id}}</td>
        <td>{{item.name}}</td>
        <td>{{item.author}}</td>
        <td>{{item.price}}</td>
        <td>{{item.c_time}}</td>
    </tr>
    {% endfor %}
</table>

<script>
    function clickHandle(e) {
        let books = {{ books_view | safe}}
        alert(JSON.stringify(books,null,"   "))
    }

</script>
</body>
</html>